#include "stdafx.h"
#include <serialization/ioParamStructs.h>
#include <serialization/serialization.h>
#include <memory>
#include <winsock/winsock_stub.h>

void shutdown_stub (
    __in  std::vector<char>& in_buf,
    __out std::vector<char>& out_buf
    )
{
//RECEIVE()
    Deserialize deserialize (in_buf);
    shutdown_in_inout shutdownIN;
    deserialize (shutdownIN);

    int ret = shutdown (shutdownIN.s_, shutdownIN.how_);
//SEND
    shutdown_out_inout shutdownOUT( (ret == 0) ? 0 : WSAGetLastError() );
    
    Serialize(deserialize.get_header(), shutdownOUT, out_buf);
}